package com.example;

import com.example.webMagic.JobProsser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import us.codecraft.webmagic.Spider;
import us.codecraft.webmagic.scheduler.BloomFilterDuplicateRemover;
import us.codecraft.webmagic.scheduler.QueueScheduler;

@Component
public class MyJob {

    @Autowired
    private JobProsser jobProsser;

    private static String url = "http://www.gli.com.cn/l/2-2-285.html";

    public void spider() {
        Spider.create(jobProsser)
                .addUrl(url)
                //使用多线程
                .thread(10)
                .run();
    }
}
